package scantask.containers;

import scantask.containers.exceptions.InvalidZoomLevelParametersException;

public class ZoomLevel {
	
	private int _from;
	private int _to;
	
	public ZoomLevel(int from, int to) throws InvalidZoomLevelParametersException {
		if ((from < 0) || (to < from)) {
			scantask.server.utilities.logging.SingletonLogger.getLogger().warning("Failed construct new ZoomLevel illegale parameters");
			scantask.client.utilities.logging.SingletonLogger.getLogger().warning("Failed construct new ZoomLevel illegale parameters");
			throw new InvalidZoomLevelParametersException();
		}
		
		this._from = from;
		this._to = to;
	}
	
	public int getFrom() {
		return this._from;
	}
	
	public int getTo() {
		return this._to;
	}
	
	public void setFrom(int from) throws InvalidZoomLevelParametersException {
		if ((from < 0) || (from > this._to)) {
			scantask.server.utilities.logging.SingletonLogger.getLogger().warning("Failed set _from ZoomLevel illegale parameters");
			scantask.client.utilities.logging.SingletonLogger.getLogger().warning("Failed set _from ZoomLevel illegale parameters");
			throw new InvalidZoomLevelParametersException();
		}
		
		this._from = from;
	}
	
	public void setTo(int to) throws InvalidZoomLevelParametersException {
		if ((to < 0) || (to < this._from)) {
			scantask.server.utilities.logging.SingletonLogger.getLogger().warning("Failed set _to ZoomLevel illegale parameters");
			scantask.client.utilities.logging.SingletonLogger.getLogger().warning("Failed set _to ZoomLevel illegale parameters");
			throw new InvalidZoomLevelParametersException();
		}
		
		this._to = to;
	}

}
